package org.jeecg.modules.util;

import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiMessageCorpconversationGetsendresultRequest;
import com.dingtalk.api.response.OapiMessageCorpconversationGetsendresultResponse;
import com.taobao.api.ApiException;
import org.jeecg.common.api.vo.Result;
import org.springframework.stereotype.Component;

/**
 * @author 王鹏
 * @version 1.0
 * @description   查询钉钉发送消息的发送结果
 * @date 2020/8/15 17:25
 */
public class SelectSendMessage {
    public static OapiMessageCorpconversationGetsendresultResponse selectsendmessage(Long taskid) throws ApiException {
        DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/topapi/message/corpconversation/getsendresult");
        OapiMessageCorpconversationGetsendresultRequest request  = new OapiMessageCorpconversationGetsendresultRequest();
        request.setAgentId(1470238867L);
        request.setTaskId(taskid);
        OapiMessageCorpconversationGetsendresultResponse response = client.execute(request, AccessTokenUtil.getToken());
        return response;
    }
}
